#include <jni.h>
#include <string>
#include "util/LogUtil.h"
#include "render/MyGLRenderContext.h"

#define NATIVE_RENDER_CLASS_NAME "com.jackykeke.opengldemo.renderer.MyNativeRender"

//java 端
//public native void native_Init();
//public native void native_UnInit();
//public native void native_SetParamsInt(int paramType, int value0, int value1);
//public native void native_SetParamsFloat(int paramType, float value0, float value1);
//public native void native_UpdateTransformMatrix(float rotateX, float rotateY, float scaleX, float scaleY);
//public native void native_SetImageData(int format, int width, int height, byte[] bytes);
//public native void native_SetImageDataWithIndex(int index, int format, int width, int height, byte[] bytes);
//public native void native_SetAudioData(short[] audioData);
//public native void native_OnSurfaceCreated();
//public native void native_OnSurfaceChanged(int width, int height);
//public native void native_OnDrawFrame();




/*
 * Class:     com_byteflow_app_MyNativeRender
 * Method:    native_Init
 * Signature: ()V
 */
JNIEXPORT void JNICALL native_Init(JNIEnv *env, jobject instance) {
    MyGLRenderContext::GetInstance();

}


static JNINativeMethod g_RenderMethods[] = {
        {"native_Init", "()V", (void *) (native_Init)},
        {},
};

static int
RegisterNativeMethods(JNIEnv *pEnv, const char *const className, JNINativeMethod *methods,
                      int methodNum) {



    return 0;
}


extern "C" jint JNI_OnLoad(JavaVM *jvm, void *p) {

    LOGCATE("====JNI_OnLoad====");
    jint jniRet = JNI_ERR;

    JNIEnv *env = NULL;

    //确定jvm的不同版本是不是1.6版本的
    if (jvm->GetEnv((void **) &env, JNI_VERSION_1_6) != JNI_OK) {

        return jniRet;
    }

    jint regRet = RegisterNativeMethods(env, NATIVE_RENDER_CLASS_NAME, g_RenderMethods,
                                        sizeof(g_RenderMethods) /
                                        sizeof(g_RenderMethods[0]));


    return JNI_VERSION_1_6;

}



